/**
 * 
 */
package br.embedded.socialapp.domain;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.jgrapht.graph.DefaultEdge;


/**
 * @author daniel
 *
 */
public class CustomEdge extends DefaultEdge {
	
	private static final long serialVersionUID = 5543534129520906860L;
	
	private List<String> socialNetworks;
	
	public CustomEdge()
	{
		super();
		this.socialNetworks = new ArrayList<String>();
	}
	
	public Iterator<String> iterator()
	{
		return socialNetworks.iterator();
	}
	
	public void addNetworkInfo(String network)
	{
		if (!socialNetworks.contains(network))
			socialNetworks.add(network);
	}
	
	@Override
	public String toString()
	{
		StringBuilder sb = new StringBuilder();
		
		sb.append("(");
		sb.append(getSource());
		sb.append(" : ");
		sb.append(getTarget());
		
		for (String network : this.socialNetworks)
		{
			sb.append(" : ");
			sb.append(network);	
		}
		sb.append(")");
		
		return sb.toString();
	}
}
